#include "chatserver.hpp"
#include "chatservice.hpp"
#include <iostream>
#include <signal.h>
using namespace std;

void resetHandler(int) {
    ChatService::instance()->reset();
    exit(0);
}

int main(int argc, char* argv[]) {
    signal(SIGINT, resetHandler);

    EventLoop loop;
    InetAddress addr(argv[1], atoi(argv[2]));

    chatServer ser(&loop, addr, "chatServer");
    ser.start();
    loop.loop();
    return 0;
}